﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:params="clr-namespace:Elysium.Parameters"
                    xmlns:controls="clr-namespace:Elysium.Controls">
    
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/Elysium;component/Themes/SharedResources.xaml"/>
        <ResourceDictionary Source="/Elysium;component/Themes/Buttons/CommandButton.xaml"/>
        <ResourceDictionary Source="/Elysium;component/Themes/Buttons/ToggleCommandButton.xaml"/>
        <ResourceDictionary Source="/Elysium;component/Themes/Buttons/DropDownCommandButton.xaml"/>
    </ResourceDictionary.MergedDictionaries>
    
    <Style x:Key="{x:Type controls:ApplicationBar}" TargetType="{x:Type controls:ApplicationBar}">
        <Style.Resources>
            <Style TargetType="{x:Type controls:CommandButton}" BasedOn="{StaticResource CommandButtonApplicationBarStyle}"/>
            <Style TargetType="{x:Type controls:ToggleCommandButton}" BasedOn="{StaticResource ToggleCommandButtonApplicationBarStyle}"/>
            <Style TargetType="{x:Type controls:DropDownCommandButton}" BasedOn="{StaticResource DropDownCommandButtonApplicationBarStyle}"/>
        </Style.Resources>        
        <Setter Property="Background" Value="{StaticResource AccentBrush}"/>
        <Setter Property="BorderBrush" Value="{StaticResource LowlightBrush}"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}"/>
        <Setter Property="FontSize" Value="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.ContentFontSize), Mode=OneWay}"/>
        <Setter Property="FontStretch" Value="Medium"/>
        <Setter Property="FontStyle" Value="Normal"/>
        <Setter Property="FontWeight" Value="Normal"/>
        <Setter Property="TextOptions.TextFormattingMode" Value="Display"/>
        <Setter Property="TextOptions.TextRenderingMode" Value="ClearType"/>
        <Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="Padding" Value="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type controls:ApplicationBar}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            TextBlock.Foreground="{TemplateBinding Foreground}"
                            TextBlock.FontFamily="{TemplateBinding FontFamily}"
                            TextBlock.FontSize="{TemplateBinding FontSize}"
                            TextBlock.FontStretch="{TemplateBinding FontStretch}"
                            TextBlock.FontStyle="{TemplateBinding FontStyle}"
                            TextBlock.FontWeight="{TemplateBinding FontWeight}"
                            TextOptions.TextFormattingMode="{TemplateBinding TextOptions.TextFormattingMode}"
                            TextOptions.TextRenderingMode="{TemplateBinding TextOptions.TextRenderingMode}"
                            RenderOptions.ClearTypeHint="{TemplateBinding RenderOptions.ClearTypeHint}"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                        <ItemsPresenter/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=FontSize, Mode=OneWay, Converter={StaticResource IsGreaterThanConverter}, ConverterParameter=18}">
                <Setter Property="TextOptions.TextFormattingMode" Value="Ideal"/>
            </DataTrigger>
        </Style.Triggers>
    </Style>
    
</ResourceDictionary>